<!--
 * @company : 版权所属 四川北星惯牌科技有限公司
 * @contact : 刘经理 19326416371
 -->
<template>
	<view class="nearbyItem flex" @click="toTeamDetails">
		<image :src="nearbyInfo.imageList[0]" class="nearbyItem-bg" mode="aspectFill"></image>
		<view class="head-box-item flex-row-center w100">
			<view class="nearbyItem-head flex-row-center">
				<!-- 状态 -->
				<template>
					<view class="state-box flex-row-center noStart" v-if="nearbyInfo.countDownState==2">
						<up-icon name="clock" color="#fff" size="22rpx"></up-icon>
						<text class="text">未开始</text>
					</view>
					<view class="state-box flex-row-center ing" v-else-if="nearbyInfo.countDownState==1">
						<up-icon name="clock" color="#fff" size="22rpx"></up-icon>
						<text class="text">进行中</text>
					</view>
					<view class="state-box flex-row-center over" v-else>
						<up-icon name="clock" color="#fff" size="22rpx"></up-icon>
						<text class="text">已结束</text>
					</view>
				</template>
				<!-- 距离 -->
				<view class="distanc-box flex-row-center">
					<up-icon name="map-fill" color="#0A534F" size="22rpx"></up-icon>
					<text class="text">{{nearbyInfo.juli}}km</text>
				</view>
			</view>
			<view class="lever-box flex-row-center">
				<image :src="nearbyInfo.vip_icon" class="vip-icon" mode=""></image>
				<template>
					<text class="text">{{nearbyInfo.vip_name}}</text>
				</template>
			</view>
		</view>
		<!-- 底部信息 -->
		<view class="nearbyItem-footer flex-row-center w100">
			<view class="nearbyItem-user flex-center">
				<image :src="nearbyInfo.avatar" class="ava" mode="aspectFill"></image>
				<text class="name">{{nearbyInfo.nickname}}</text>
			</view>
			<text class="seat-text">座位情况：{{nearbyInfo.join_number}}/{{nearbyInfo.number_people}}</text>
		</view>
	</view>
</template>

<script setup>
	const props = defineProps({
		nearbyInfo: {
			default: {}
		}
	})
	const nearbyInfo = computed(() => props.nearbyInfo)
	const toTeamDetails = () => {
		uni.navigateTo({
			url: '/page_main/views/teamDetails?id=' + nearbyInfo.value.t_id
		})
	}
</script>

<style lang="scss" scoped>
	.nearbyItem {
		width: 100%;
		height: 100%;
		position: relative;
		border-radius: 12rpx;
		overflow: hidden;
		box-sizing: border-box;
		padding: 24rpx;
		flex-direction: column;
		justify-content: space-between;

		.nearbyItem-bg {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
		}

		.head-box-item {
			justify-content: space-between;
			z-index: 9;

			.state-box {

				height: 42rpx;
				// background: rgba(0, 0, 0, 0.4);
				border-radius: 21rpx;
				padding: 0 14rpx;
				margin-right: 16rpx;

				.text {
					font-weight: 500;
					font-size: 24rpx;
					color: #fff;
					margin-left: 8rpx;
				}
			}

			.lever-box {
				.vip-icon {
					width: 32rpx;
					height: 32rpx;
				}

				height: 42rpx;
				border-radius: 21rpx;
				padding: 0 14rpx;
				// background: #3c9cff;
				background: rgba(0, 0, 0, 0.4);
				margin-right: 16rpx;

				.text {
					font-weight: 500;
					font-size: 24rpx;
					color: #fff;
					margin-left: 8rpx;
				}
			}
		}

		.nearbyItem-head {
			position: relative;

			.distanc-box {
				height: 42rpx;
				padding: 0 14rpx;
				background: $btn-bg-color;
				border-radius: 50rpx;

				.text {
					font-weight: 500;
					font-size: 24rpx;
					color: $btn-text-color;
					margin-left: 8rpx;
				}
			}
		}

		.nearbyItem-footer {
			justify-content: space-between;
			z-index: 9;
			position: absolute;
			bottom: 0;
			left: 0;
			padding: 24rpx;
			background: linear-gradient(180deg, transparent, #191C1F);

			.nearbyItem-user {
				.ava {
					width: 48rpx;
					height: 48rpx;
					border-radius: 50%;
					margin-right: 16rpx;
				}

				.name {
					width: 184rpx;
					font-weight: bold;
					font-size: 32rpx;
					color: #E9E6E4;
					text-overflow: ellipsis;
					white-space: nowrap;
					overflow: hidden;
				}
			}

			.seat-text {
				font-weight: 800;
				font-size: 24rpx;
				color: #E4E4E5;
			}
		}
	}

	.ing {
		background-color: #fa3534;
	}

	.noStart {
		// background: $btn-bg-color;
		background: #3c9cff;
	}

	.over {
		background-color: #909399;
	}
</style>